package com.ruoyi.web.controller.cems;


import com.ruoyi.cems.domain.BmsUserMessage;
import com.ruoyi.cems.service.IBmsUserMessageService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@Api(description = "用户消息")
@RestController
@RequestMapping("/cems/messagge")
public class BmsUserMessageController extends BaseController
{

    @Autowired
    private IBmsUserMessageService bmsUserMessageService;

    @ApiOperation(value = "查询用户消息列表")
    @GetMapping("/list")
    public TableDataInfo list(BmsUserMessage bmsUserMessage) {
        startPage();
        bmsUserMessage.setUserId(getUserId().toString());
        List<BmsUserMessage> list = bmsUserMessageService.selectBmsUserMessageList(bmsUserMessage);
        return getDataTable(list);
    }

    @ApiOperation(value = "获取用户消息详细信息")
    @GetMapping(value = "/{ID}")
    public AjaxResult getInfo(@PathVariable("ID") String ID) {
        return AjaxResult.success(bmsUserMessageService.selectBmsUserMessageByID(ID));
    }
    @ApiOperation(value = "修改用户消息")
    @PutMapping
    public AjaxResult edit(@RequestBody BmsUserMessage bmsUserMessage) {
        return toAjax(bmsUserMessageService.updateBmsUserMessage(bmsUserMessage));
    }
}
